- viewservicebillingreport.php
- project /
1 <?php
2 session_start();
3 include("header.php");
4 include("sidebar.php");
5 include("dbconnection.php");
6 $result= mysql_query("select * from service where serviecid='$_POST[serviceid]'");
7 $row1 = mysql_fetch_array($result);
8
9 $result1= mysql_query("select * from customer where custid='$_POST[customerid]'");
10 $arrrec2= mysql_fetch_array($result1);
11
12
13 $dt = date("Y-m-d");
14 if($_POST["vehstatus"] == "Completed")
15 {
16 $sql ="insert into billing(serviceid,particulars,scost,date,paidstatus) values('$_POST[serviceid]','$_POST[particulars]','$_POST[vehcost]','$dt','$_POST[vehstatus2]')";
17 if (!mysql_query($sql,$con))
18 {
19 die('Error: ' . mysql_error());
20 }
21 $insid = mysql_insert_id();
22
23 mysql_query("UPDATE service SET status='$_POST[vehstatus]' where serviecid='$_POST[serviceid]'");
24 }
25 if($_POST["vehstatus"] == "Cancelled")
26 {
27 $sql ="insert into billing(serviceid,particulars,scost,date,paidstatus) values('$_POST[serviceid]','Calncelled','0.00','$dt','Cancelled')";
28 if (!mysql_query($sql,$con))
29 {
30 die('Error: ' . mysql_error());
31 }
32 $insid = mysql_insert_id();
33
34 mysql_query("UPDATE service SET status='$_POST[vehstatus]' where serviecid='$_POST[serviceid]'");
35 }
36 ?>
37
38
39 <div id="main">
40
41 <a name="TemplateInfo"></a>
42
43 <?php
44 if($ctins == 1)
45 {
46 echo "<center><b>Employees account created successfully...</b></center><br>";
47 echo "<center><b><a href='emplogin.php'>Click here to Login.</a></b></center>";
48 }
49 else
50 {
51 ?>
52 <form id="form1" name="form1" method="post" action="">
53 <table width="494" border="1">
54 <tr>
55 <th colspan="2" scope="col"><h1>E-Workshop</h1></th>
56 </tr>
57 <tr>
58 <th height="40" scope="col">Bill No. : <?php echo $insid; ?></th>
59 <th scope="col">Date: <?php echo $dt; ?></th>
60 </tr>
61 <tr>
62 <th width="237" height="45" scope="col">Sevice ID: </th>
63 <th width="241" scope="col"> <?php echo $_POST[serviceid]; ?></th>
64 </tr>
65 <?php
66 $result1= mysql_query("select * from customer where custid='$row1[custid]'");
67 $arrrec1= mysql_fetch_array($result1);
68 ?>
69 <tr>
70 <th height="44" scope="col">Customer ID : <?php echo $arrrec2[custid]; ?></th>
71 <th scope="col">Customer name : <?php echo $arrrec2[fname]. " ". $arrrec2[lname]; ?></th>
72 </tr>
73 <tr>
74 <th height="35" scope="col">Vehicle name : <?php echo $row1[vehiclename]; ?></th>
75 <th scope="col">Vehicle No. : <?php echo $row1[vehicleno]; ?></th>
76 </tr>
77 <tr>
78 <th scope="col">Address</th>
79 <th scope="col">Address : <?php echo $row1[address]; ?> <br />
80 City : <?php echo $row1[city]; ?><br />
81 ZIP code: <?php echo $row1[zipcode]; ?></th>
82 </tr>
83 <?php
84 while($arrrec= mysql_fetch_array($result))
85 {
86 $result1= mysql_query("select * from customer where custid='$arrrec[custid]'");
87 $arrrec1= mysql_fetch_array($result1);
88 echo" <tr>
89 <td> $arrrec[serviecid]</td>";
90 echo "<td> $arrrec1[fname] $arrrec1[lname]</td>
91 <td> $arrrec[vehiclename]</td>
92 <td> $arrrec[date]</td>
93 <td> $arrrec[address]
94 <br> City: $arrrec[city]
95 <br> landmark: $arrrec[landmark]
96 <br> PIN: $arrrec[zipcode]</td>
97 <td> More | Billing</td>
98 </tr>";
99 }
100 ?>
101
102 <tr>
103 <th width="237" height="36" scope="col">Particulars</th>
104 <th width="241" scope="col"><label for="particulars"></label>
105 <?php echo
106 $_POST[particulars]; ?> </th>
107 </tr>
108 <?php
109 $result1= mysql_query("select * from customer where custid='$row1[custid]'");
110 $arrrec1= mysql_fetch_array($result1);
111 ?>
112 <tr>
113 <th height="30" scope="col">Service Cost</th>
114 <th scope="col"><?php echo
115 $_POST[vehcost]; ?></th>
116 </tr>
117 <tr>
118 <th height="37" scope="col">Paid status</th>
119 <th scope="col"> <?php echo
120 $_POST[vehstatus2]; ?></th>
121 </tr>
122 <tr>
123 <th height="23" scope="col"> </th>
124 <th scope="col"> </th>
125 </tr>
126 <tr>
127 <th height="37" colspan="2" scope="col">
128 <input type="button" name="btnpay" id="btnpay" value="Print" onClick="window.print()"> </th>
129 </tr>
130 <?php
131 while($arrrec= mysql_fetch_array($result))
132 {
133 $result1= mysql_query("select * from customer where custid='$arrrec[custid]'");
134 $arrrec1= mysql_fetch_array($result1);
135 echo" <tr>
136 <td> $arrrec[serviecid]</td>";
137 echo "<td> $arrrec1[fname] $arrrec1[lname]</td>
138 <td> $arrrec[vehiclename]</td>
139 <td> $arrrec[date]</td>
140 <td> $arrrec[address]
141 <br> City: $arrrec[city]
142 <br> landmark: $arrrec[landmark]
143 <br> PIN: $arrrec[zipcode]</td>
144 <td> More | Billing</td>
145 </tr>";
146 }
147 ?>
148 </table>
149
150 </form>
151 <?php
152 }
153 ?>
154
155 <br />
156
157 </div>
158
159 <!-- wrap ends here -->
160 </div>
161
162 <?php
163 include("footer.php");
164 ?>